import 'package:common_utils/common_utils.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';
import 'package:paly_android/api/api.dart';
import 'package:paly_android/bean/article_data_entity.dart';
import 'package:paly_android/net/dio_client.dart';

part 'project_tree_list_event.dart';

part 'project_tree_list_state.dart';

class ProjectTreeListBloc
    extends Bloc<ProjectTreeListEvent, ProjectTreeListState> {
  ProjectTreeListBloc() : super(ProjectTreeListState(List.empty()));

  @override
  Stream<ProjectTreeListState> mapEventToState(
      ProjectTreeListEvent event,) async* {
    ArticleDataEntity f = await DioClient.instance.get(
        Api.PROJECT_TREE_LIST.replaceFirst("page", event.PAGE.toString())
            .replaceFirst("num", event.CID));

    yield ProjectTreeListState(f.datas);
  }



}
